package JET.VirtualKeyboard;

import JET.physics.engine.JETContext;

/**
 *
 * @author 057Ry
 */
public class KeyHelper {

    /**
     * Calculates time since last key action.
     * If key is pressed then returned time is press time,
     * if key is released then returned time is time which passed
     * since last key release.
     * 
     * @param vKey Key that press/release time is calculted
     * @param engine actual simulation engine/scene for which time is calculted
     * @return  Time in seconds of key press or after release.
     */
    public static double getPressReleaseTime(VKey vKey, JETContext engine) {
        return engine.getTime() - vKey.getPressReleaseMoment();
    }
}
